www.gusucode.com > 星梦奇缘交友网 1 > 星梦奇缘交友网 1.0源码程序/love/admin/Help.asp
<!--#include file =../conn.asp--> <!-- #include file="inc/const.asp" --> <% Head() dim admin_flag admin_flag=",3," If Not master or instr(","&session("flag")&",",admin_flag)=0 Then Errmsg=ErrMsg + "<BR><li>本页面为管理员专用,请<a href=../"&LoginUrl&" target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。" Ms_error() Else select case request("action") case "save1" save1() case "save2" save2() case "save3" save3() case "search" search() case "view" view() case "edit" edit() case "del" del() case else consted() end select If founderr then call Ms_error() footer() End If %><script language = 'JavaScript'> function selectPaginationType(){ document.theForm.PaginationType.value=2; } function CheckForm(){ var CurrentMode=editor.CurrentMode; if (CurrentMode==0){ document.theForm.Content.value=editor.HtmlEdit.document.body.innerHTML; } else if(CurrentMode==1){ document.theForm.Content.value=editor.HtmlEdit.document.body.innerText; } else{ alert('预览状态不能保存!请先回到编辑状态后再保存'); editor.HtmlEdit.focus(); return false; } if (document.theForm.Title.value==''){ alert('文章标题不能为空!'); document.theForm.Title.focus(); return false; } if (document.theForm.Content.value==''){ alert('文章内容不能为空!'); editor.HtmlEdit.focus(); return false; } } </script> <% sub consted() dim sel %> <table width="95%" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder"> <tr> <th height="23" colspan="3" class="tableHeaderText">帮助管理 | <a href="../help.asp" target=_blank><font color=#FFFFFF>预览帮助</font></a></th> </tr> <FORM METHOD=POST ACTION="help.asp?action=search"> <tr> <td height="25" colspan="3" class="forumrow"> <B>输入帮助关键字</B>:<input type="text" name="keyword" size=50> <input type=submit name=submit value="搜 索"><BR><BR>输入帮助关键字进行搜索,不输入查询条件为显示所有帮助 </td> </tr> </FORM> </table><BR> <% search() %><BR> <table width="95%" border="0" cellspacing="1" cellpadding="3" align=center class="tableBorder"> <tr><th height=23>系统帮助添加</th></tr> <tr> <td width="48%" class="forumRowHighlight" valign=top> <li>所添加内容将自动显示于前台的帮助页面; <li>添加一级分类方法:选取下拉选项“<font color=blue>作为一级分类</font>”,并填写旁边分类标题,标题与内容可以不填写; <BR> </td> </tr> <tr> <td width="100%" class="forumRow" valign=top> <table width=100% > <FORM METHOD=POST ACTION="help.asp?action=save1" onSubmit='return CheckForm();' name="theForm"> <tr> <td width=61>标题:</td> <td width=650><input type="text" name="title" size=50></td> </tr> <tr> <td width=61>分类:</td> <td width=650> <select name="classid"> <% set rs=Conn.Execute("select h_id,h_title from Ms_help where h_type=0 and h_parentid=0") do while not rs.eof Response.Write "<option value="&rs("h_id")&">"&server.htmlencode(rs("h_title"))&"</option>" rs.movenext loop rs.close set rs=nothing %> <option value="0">作为一级分类</option> </select><select name="ctype" size=1> <option value=0 selected>前台</option> <option value=1>后台</option> </select> </td> </tr> <tr> <td width=61>类型:</td> <td width=650><input type=checkbox name="stype" checked value="1"> 选择此项所添加内容将不显示在帮助文件首页中</td> </tr> <tr> <td width=61>内容:</td> <td width=650> <textarea name='Content' style='display:none'></textarea> <iframe id='editor' src='../editor.asp' frameborder=0 scrolling=no width='520' height='405'></iframe> </tr> <tr align="center"> <td colspan="2"> <input type=submit name=submit value="保 存"> </td> </tr> </FORM> </table> </td> </tr> </table> <% end sub sub save1()''新添加记录 dim title,content,parentid,stype,H_id if Request.form("classid")="0" then if request("title")="" then Errmsg="请填写类别标题" founderr=true exit sub else title=request("title") end if ParentID=0 else if request("title")="" then Errmsg="请填写帮助标题" founderr=true exit sub else title=request("title") end if ParentID=Request.form("classid") end if if request("stype")="1" then stype=1 else stype=0 end if set rs=server.createobject("adodb.recordset") sql="select * from Ms_help" rs.open sql,conn,1,3 rs.addnew rs("h_parentid")=parentid rs("h_title")=title rs("h_content")=request.form("content") rs("h_type")=request("ctype") rs("h_stype")=stype if Request.form("classid")="0" then rs("H_Layers")=0 else rs("H_RootID")=parentid rs("H_Layers")=1 end if rs.update rs.close set rs=nothing set rs=conn.execute("select top 1 H_id from Ms_help order by H_ID desc") H_id=rs(0) conn.execute("update Ms_help set H_RootID="&H_id&" where H_id="&H_id) if Request.form("classid")="0" then Ms_suc("保存一级类别成功!") else Ms_suc("保存帮助成功!") end if end sub sub save3() dim title,content,parentid,stype if Request.form("classid")="0" then if request("title")="" then Errmsg="请填写类别标题" founderr=true exit sub else title=request("title") end if ParentID=0 else if request("title")="" then Errmsg="请填写帮助标题" founderr=true exit sub else title=request("title") end if ParentID=Request.form("classid") end if if request("stype")="1" then stype=1 else stype=0 end if set rs=server.createobject("adodb.recordset") sql="select * from Ms_help where h_id="&request("id") rs.open sql,conn,1,3 if not rs.eof then rs("h_parentid")=parentid rs("h_title")=title rs("h_content")=request("content") rs("h_type")=request("ctype") rs("h_stype")=stype if Request.form("classid")="0" then rs("H_Layers")=0 rs("H_RootID")=request("id") else rs("H_RootID")=parentid rs("H_Layers")=1 end if end if rs.update rs.close set rs=nothing if Request.form("classid")="0" then Ms_suc("保存一级类别成功!") else Ms_suc("保存帮助成功!") end if end sub function search() %> <table width="95%" border="0" cellspacing="1" cellpadding="5" align=center class="tableBorder"> <tr> <th height="23" class="tableHeaderText" colspan=2>系统帮助管理列表</th> </tr> <% dim keyword,SQL set rs=server.createobject("adodb.recordset") if request("stype")<>"" then sql=" h_type="&request("stype") end if if request("keyword")<>"" then if sql<>"" then sql=sql & " and h_title like '%"&replace(request("keyword"),"'","")&"%' or h_content like '%"&replace(request("keyword"),"'","")&"%'" else sql=" h_title like '%"&replace(request("keyword"),"'","")&"%' or h_content like '%"&replace(request("keyword"),"'","")&"%'" end if end if strFileName="help.asp?action="&request("action")&"&keyword="&request("keyword")&"&stype="&request("stype")&"" call tumppages() if sql="" then sql="select * from Ms_help where not h_id=1 order by H_RootID asc,H_id" else sql="select * from Ms_help where "&sql&" and not h_id=1 order by H_RootID asc,H_id" end if rs.open sql,conn,1,1 if not (rs.eof and rs.bof) then call rspages() do while (not rs.eof) and page_count<Cint(MaxPerPage) %> <tr><td class=forumrowhighlight width=80% nowrap> <B><%if rs("H_layers")=0 then Response.Write "┼" & rs("h_title") else Response.Write " ├" & rs("h_title") end if %></B><% if rs("H_ParentID")=0 then Response.Write " <font color=red>[一级分类]</font>" End If %> </td> <td class=forumrowhighlight width=20% align=right nowrap> [<a href="help.asp?action=view&id=<%=rs(0)%>">查看内容</a>] [<a href="help.asp?action=edit&id=<%=rs(0)%>">编辑</a>] [<a href="help.asp?action=del&id=<%=rs(0)%>">删除</a>] </td> </tr> <% page_count=page_count+1 rs.movenext loop else response.Write("<tr> <td height=""23"" class=""forumrowhighlight"" colspan=2>没有找到任何帮助</td></tr>") end if%> <tr align="center"> <td height="24" colspan="2" class=forumrow> <%if totalrec>0 then call showpage(strFileName) end if%></td> </tr> <% rs.close set rs=nothing %> </table> <% end function function view() %> <table width="95%" border="0" cellspacing="0" cellpadding="3" align=center class="tableBorder"> <tr> <th height="23" class="tableHeaderText">查看系统帮助</th> </tr><tr> <td height="23" class="forumrowhighlight"> <% set rs=Conn.Execute("select * from Ms_help where h_id="&request("id")) if rs.eof and rs.bof then Response.Write "没有找到帮助" else Response.Write "<BR><center><b>"&rs("h_title")&"</b></center><BR><BR><BR>" Response.Write "<blockquote>"&rs("h_content")&"</blockquote>" Response.Write "<div align=right>[<a href=help.asp?action=edit&id="&rs(0)&">编辑</a>] [<a href=help.asp?action=del&id="&rs(0)&">删除</a>]</div>" end if %> </td> </tr> </table> <% end function function edit() %> <table width="95%" border="0" cellspacing="0" cellpadding="3" align=center class="tableBorder"> <tr> <th height="23" class="tableHeaderText">系统帮助编辑</th> </tr><tr> <td height="23" class="forumRow"> <% dim trs set rs=Conn.Execute("select * from Ms_help where h_id="&request("id")) if rs.eof and rs.bof then Response.Write "没有找到帮助" else %> <table width=100% > <FORM METHOD=POST ACTION="help.asp?action=save3" onSubmit='return CheckForm();' name="theForm"> <input type=hidden value="<%=request("id")%>" name="id"> <tr> <td width=62>标题:</td> <td width=651><input type="text" name="title" size=35 value="<%if not rs("h_parentid")=0 then Response.Write server.htmlencode(rs("h_title"))%>"> <select name="ctype" size=1> <option value=0 <%if rs("h_type")=0 then Response.Write "selected"%>>前台</option> <option value=1 <%if rs("h_type")=1 then Response.Write "selected"%>>后台</option> </select> </td> </tr> <tr> <td width=62>分类:</td> <td width=651> <select name="classid"> <% set trs=Conn.Execute("select * from Ms_help where h_parentid=0 order by H_type ") do while not trs.eof Response.Write "<option value="&trs("h_id") if rs("h_parentid")=trs(0) then Response.Write " selected" Response.Write ">"&server.htmlencode(trs("h_title")) if Cint(trs("H_type")) = 1 Then Response.Write " [后台]" Else Response.Write " [前台]" Response.Write "</option>" trs.movenext loop trs.close set trs=nothing %> <option value="0" <%if rs("h_parentid")=0 then Response.Write "selected"%>>作为一级分类</option> </select> <input type="text" name="classtitle" size=30 value="<%if rs("h_parentid")=0 then Response.Write server.htmlencode(rs("h_title"))%>"> </td> </tr> <tr> <td width=62>类型:</td> <td width=651><input type=checkbox name="stype" value="1" <%if rs("h_stype")=0 then Response.Write "checked"%>> 选择此项所添加内容将不显示在帮助文件首页中</td> </tr> <tr> <td width=62>内容:</td> <td width=651> <textarea name='Content' style='display:none'><%if not isnull(rs("h_content")) and rs("h_content")<>"" then%><%=rs("h_content")%><%end if%></textarea> <iframe id='editor' src='../editor.asp' frameborder=0 scrolling=no width='520' height='405'></iframe> </tr> <tr align="center"> <td height="29" colspan="2"> <input type=submit name=submit value="保存修改"> </td> </tr> </FORM> </table> <% end if %> </td> </tr> </table> <% end function function del() Conn.Execute("delete from Ms_help where (not h_id=1) and h_id="&Request("id")) Ms_suc("删除系统帮助成功!") end function %>